package com.nuhu.controller;

import com.nuhu.pojo.RepairRecord;
import com.nuhu.service.MaintainRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MaintainRecordController {
    @Autowired
    private MaintainRecordService maintainRecordService;

    @PostMapping("/maintain")
    public String maintainInsert(@RequestBody RepairRecord repairRecord){
        maintainRecordService.maintainInsert(repairRecord);
        return "维修记录提交成功，请耐心等待客服回复";
    }

    @RequestMapping("/maintain1")
    public String maintainSetIssueResolved(@RequestBody RepairRecord repairRecord){
        maintainRecordService.maintainSetIssueResolved(repairRecord);
        return "Maintain Record Update success";
    }

    @PostMapping("/maintain2")
    public void maintainSetIsSigned(@RequestBody RepairRecord repairRecord){
        maintainRecordService.maintainSetIsSigned(repairRecord);
    }

    @RequestMapping("/maintain3")
    public RepairRecord maintainGetIsSigned(){
        return maintainRecordService.maintainGetIsSigned();
    }

    @RequestMapping("/maintain5")
    public RepairRecord maintainSelect(){
        return maintainRecordService.maintainSelect();
    }
}
